﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using EntitySetBase;

namespace Models
{
    [Table("parameter")]
    public class Parameter : EntitySet
    {
        public Parameter()
        {
            Children = new HashSet<Parameter>();
        }

        /// <summary>
        /// 名字
        /// </summary>
        [Column("name"), Required, MaxLength(36)]
        public string Name { get; set; }
        /// <summary>
        /// 值
        /// </summary>
        [Column("value"), Required, MaxLength(128)]
        public string Value { get; set; }
        /// <summary>
        /// 显示的名字
        /// </summary>
        [Column("text"), Required, MaxLength(36)]
        public string Text { get; set; }

        /// <summary>
        /// Parent 的外键
        /// </summary>
        [Column("parent_id"), MaxLength(36)]
        public string ParentId { get; set; }

        public virtual Parameter Parent { get; set; }
        public virtual ICollection<Parameter> Children { get; set; }
    }
}
